Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Temp-table buffer methods and attributes
In addition to the default buffer handle that is an attribute of every temp-table, you can create one or more dynamic buffers for a dynamic temp-table. Use this syntax:
Note that it is necessary to include the reference to the
DEFAULT-BUFFER-HANDLE. For example, you can create a second dynamic buffer for the temp-table in the current example with these statements:
Now you have two dynamic buffers for the temp-table, one called
CustSeqthat you get “for free” along with the temp-table definition and a second that you created yourself.The dynamic buffer methods that you learned about earlier are essential to using dynamic temp-tables and their buffer. In particular, you will use the
BUFFER-CREATEmethod on the buffer handle to create records in the dynamic temp-table,BUFFER-DELETEto delete them,BUFFER-RELEASEto release them, andBUFFER-COPYto copy fields from one or more database tables into newly created records in the temp-table.There are a couple of additional buffer methods and attributes specific to their association with temp-tables, however.
TABLE-HANDLE buffer attribute
This attribute returns the handle of the temp-table the buffer is associated with. For a buffer not associated with a temp-table, it returns the Unknown value (
?). Therefore, the temp-table’sDEFAULT-BUFFER-HANDLEpoints to its default buffer, and that buffer’sTABLE-HANDLEattribute points back to the temp-table. In addition, theTABLE-HANDLEattribute of any other buffer defined or created for the temp-table, such asCustSeq2, also points back to the temp-table.EMPTY-TEMP-TABLE buffer method
It is much more efficient to empty a temp-table in one statement rather than in a
FOR EACHloop. To empty a static temp-table you can use theEMPTY TEMP-TABLEtt-namestatement. With the handle of a buffer for the temp-table, you can also use theEMPTY-TEMP-TABLEmethod on the buffer. It takes no arguments. Remember that while you can have multiple buffers associated with a temp-table, just as you can with a database table, there is only one set of records in the temp-table. The multiple buffers simply allow you to have pointers to multiple different records in the temp-table at the same time. Thus, you can use theEMPTY-TEMP-TABLEmethod on any buffer for the temp-table and the result is the same.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |